﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace WOS.Common
{
    internal enum ItemType
    {
        Download,
        Upload
    }
    internal abstract class Item : INotifyPropertyChanged
    {
        #region Private Members
        private readonly Guid _id;

        #endregion
        #region Constructors
        protected Item(Guid id, string name)
        {
            this._id = id;
            this._name = name;
        }
        #endregion

        #region Events
        public event EventHandler IndexChanged;
        public event EventHandler NameChanged;
        #endregion

        #region Public Members
        public Guid Id
        {
            get { return this._id; }
        }
        private int _index;
        public int Index
        {
            get { return this._index; }
            set
            {
                if (value != this._index)
                {
                    this._index = value;
                    NotifyPropertyChanged("Index");
                }
            }
        }

        public string _name;
        public string Name
        {
            get
            {
                return this._name;
            }

            set
            {
                if (value != this._name)
                {
                    this._name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

        public abstract ItemType Type { get; }
        #endregion
        public void NotifyPropertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }

}
